<?php

/**
 * Description of Ajax
 *
 * @author user3
 */
class Ga_Controller_Action_Helper_Ajax extends Zend_Controller_Action_Helper_AjaxContext {

    public function direct($viewRender = false)
    {

        $request = $this->getRequest();
        if (!$request->isXmlHttpRequest()) {
            throw new Bluembo_Exception("Cannot define Ajax Helper in the same action as page!");
        }
        $request->setParam('format', $request->getParam('format', 'html'));
        $this->addActionContext($request->getActionName(), $request->getParam('format'))->initContext();
        $this->_getViewRenderer()->setNoRender(!$viewRender);
    }

    public function getName()
    {
        return 'Ajax';
    }

}